package com.du.cloud.service.admin.api.feign;

import com.du.cloud.common.base.constant.SecurityConstants;
import com.du.cloud.common.base.constant.ServiceNameConstants;
import com.du.cloud.common.base.utils.Result;
import com.du.cloud.service.admin.api.model.dto.UserInfo;
import com.du.cloud.service.admin.api.feign.factory.RemoteUserServiceFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.ADMIN_SERVICE, fallbackFactory = RemoteUserServiceFallbackFactory.class)
public interface RemoteUserService {

    /**
     * 查询用户信息
     * @param username
     * @return
     */
    @GetMapping("/user/info/{username}")
    Result<UserInfo> info(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM) String from);

}
